package com.fyl.service.impl;

import com.fyl.dao.UserDao;
import com.fyl.mapper.UserMapper;
import com.fyl.pojo.User;
import com.fyl.service.UserService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.ServletContextAware;

import javax.servlet.ServletContext;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
//implements UserService, ServletContextAware, ApplicationContextAware, BeanFactoryAware, BeanNameAware
public class UserServiceImpl implements UserService {

    private UserMapper userMapper;

    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    public void show() {
        List<User> all = userMapper.findAll();
        all.forEach(System.out::println);
    }
    //    public UserServiceImpl() {
//        System.out.println("UserServiceImpl创建");
//    }

   // private UserDao userDao;
//    private List<String> stringList;
//    private List<UserDao> userDaoList;
//    private List<Integer> integerList;
//    private Set<String> stringSet;
//    private Set<UserDao> userDaoSet;
//    private Set<Integer> integerSet;
//    private Map<String,UserDao> userDaoMap;
//    private Properties properties;

//    public void setUserDao(UserDao userDao) {
//        System.out.println("开始设置userDao属性");
//        this.userDao = userDao;
//    }

//    public void setStringList(List<String> stringList) {
//        System.out.println("开始设置stringList属性");
//        this.stringList = stringList;
//    }
//
//    public void setUserDaoList(List<UserDao> userDaoList) {
//        System.out.println("开始设置userDaoList属性");
//        this.userDaoList = userDaoList;
//    }
//
//    public void setIntegerList(List<Integer> integerList) {
//        this.integerList = integerList;
//    }
//
//    public void setStringSet(Set<String> stringSet) {
//        this.stringSet = stringSet;
//    }
//
//    public void setUserDaoSet(Set<UserDao> userDaoSet) {
//        this.userDaoSet = userDaoSet;
//    }
//
//    public void setIntegerSet(Set<Integer> integerSet) {
//        this.integerSet = integerSet;
//    }
//
//    public void setUserDaoMap(Map<String, UserDao> userDaoMap) {
//        this.userDaoMap = userDaoMap;
//    }
//
//    public void setProperties(Properties properties) {
//        this.properties = properties;
//    }

//    public void show(){
//        System.out.println("userDao = " + userDao);
////        System.out.println("stringList = " + stringList);
////        System.out.println("userDaoList = " + userDaoList);
////        System.out.println("integerList = " + integerList);
////        System.out.println("stringSet = " + stringSet);
////        System.out.println("userDaoSet = " + userDaoSet);
////        System.out.println("integerSet = " + integerSet);
////        System.out.println("userDaoMap = " + userDaoMap);
////        System.out.println("properties = " + properties);
//    }

//    @Override
//    public void setServletContext(ServletContext servletContext) {
//        System.out.println("servletContext = " + servletContext);
//    }
//
//    @Override
//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//        System.out.println("applicationContext = " + applicationContext);
//    }
//
//    @Override
//    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
//        System.out.println("beanFactory = " + beanFactory);
//    }
//
//    @Override
//    public void setBeanName(String beanName) {
//        System.out.println("beanName = " + beanName);
//    }

    //    public void init(){
//        System.out.println("初始化方法...");
//    }
//
//    public void destroy(){
//        System.out.println("销毁方法...");
//    }

//    public UserServiceImpl() {
//        System.out.println("无参构造UserServiceImpl实例化");
//    }
//
//    public UserServiceImpl(String name,int age) {
//        System.out.println("有参构造UserServiceImpl实例化");
//    }
//
//
//    /**
//     *BeanFactory去调用该方法获得userDao设置到此处
//     */
//    public void setUserDao(UserDao userDao) {
//        //System.out.println("BeanFactory去调用该方法获得userDao设置到此处"+userDao);
//        System.out.println("属性设置完毕");
//        this.userDao = userDao;
//    }

//    @Override
//    public void afterPropertiesSet() throws Exception {
//        System.out.println("afterPropertiesSet执行...");
//    }
}
